package com.Tcp;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.Socket;

public class NetClient {
	String userName = null;
	String userPass = null;

	public NetClient(String userName, String userPass) {
		this.userName = userName;
		this.userPass = userPass;
	}

	public void connect(String Ip, int Tcp_port) {
		Socket s = null;
		 DataOutputStream dos = null;  
	     DataInputStream dis = null;  
		try {
			s = new Socket(Ip, Tcp_port);
			dos=new DataOutputStream(s.getOutputStream());
			dos.writeUTF(userName);
			dos.writeUTF(userPass);
			
		} catch (Exception e) {
			e.printStackTrace();
		}finally{ 
            if(s!=null) {  
                try {  
                    dos.close();  
                    s = null;  
                } catch (Exception e) {  
                    // TODO Auto-generated catch block  
                    e.printStackTrace();  
                }  
	}
	}
	}
}
